import {defineStore} from 'pinia'
// import {verifyToken} from "@/api/client/user";
import {getToken} from "@/utils/tools/auth";


export const useIkarosStore = defineStore("ikaros", {
    state: () => ({
        /** ikaros 是否显示  **/
        isShow:  true,
        /** ikaros 是否开启音频  **/
        isAudio: false,
        /** ikaros 是否开启对话  **/
        isChat: true
    }),
    getters: {
        SET_isShow: (state, isShow) => {
            state.isShow = isShow
        },
        SET_isAudio: (state, isAudio) => {
            state.isAudio = isAudio
        },
        SET_isChat: (state, isChat) => {
            state.isChat = isChat
        }
    },
    actions: {
         loadIkaros() {
            return new Promise((resolve, reject) => {
                if (getToken()) {
                    // verifyToken().then(res => {
                    //     if (res.data === 'admin') {
                    //         this.isShow = true;
                    //     }
                    // })
                }else {
                    this.isShow = false;
                }
            })
        }
    }
})
